package com.hk.pinda;


import com.hk.pinda.auth.server.EnableAuthServer;
import com.hk.pinda.user.annotation.EnableLoginArgResolver;
import com.hk.pinda.validator.config.EnableFormValidator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;


@EnableFormValidator
@EnableLoginArgResolver
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
@Slf4j
@EnableFeignClients(value = {"com.hk.pinda"})
@EnableAuthServer
@EnableDiscoveryClient
@SpringBootApplication
public class AuthorityApplication  {

    public static void main(String[] args) throws UnknownHostException {

        ConfigurableApplicationContext applicationContext = SpringApplication.run(AuthorityApplication.class, args);
        Environment environment = applicationContext.getEnvironment();
        log.info("应用 {} 运行成功！ Swagger 文档： http://{}:{}/doc.html", environment.getProperty("spring.application.name"),
                InetAddress.getLocalHost().getHostAddress(),
                environment.getProperty("server.port"));

    }
}
